home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 62 / Mac Magazin and MacEasy Magazine CD - Issue 62.iso / Software / Mobiles Büro / Newton / Entwickler / Mapper 1.2 Source / Starter Mapper Module / ProjectData next >
Text File  |  1999-08-22  |  4KB  |  116 lines

  1. /*
  2.  * Starter Mapper Module
  3.  * ---------------------
  4.  * Created by Foundation Systems and Adam Tow
  5.  * Changes in v1.1.1 by Michael J. Hußmann
  6.  * Last Modified: August 22, 1999
  7.  *
  8.  * Description: This ProjectData file contains all you need to create a Mapper Map Module.
  9.  * Comments begin with the "//" string.
  10.  *
  11.  * Modify those lines whose comments begin with "MODIFY". Do not modify the lines whose comments
  12.  * read "DO NOT MODIFY"
  13.  *
  14.  *
  15.  * When you are ready to build your Mapper Map Module, following these steps:
  16.  *
  17.  *         1)  Click on the Project menu.
  18.  *         2)  In the list that appears, select "Project Settings..."
  19.  *         3)  Click on "Output Settings" in the left pane.
  20.  *         4)  Enter the name of your Mapper Module.
  21.  *         5)  Enter the Symbol of your Mapper Module. Suggest: "My Map:Mapper:SIG" where "My Map" is the
  22.  *                name of your map and "SIG" is your Newton Developer Signature.
  23.  *         6)  Copy the result from (5) to your clipboard.
  24.  *         7)  Click on Package Settings in the left pane.
  25.  *         8)  Paste (6) in the Name field.
  26.  *         9)  Click OK.
  27.  *         10) Click on the Project menu.
  28.  *         11) In the list that appears, select "Build Package" and download the package to your Newton.
  29.  *
  30.  */
  31.  
  32.  
  33. constant kVersionStr := "1.0";                                        // MODIFY: The Version String of your Mapper Module
  34. constant kAppTitle := kAppName && kVersionStr;                        // DO NOT MODIFY
  35. constant kMapperAppSymbol := '|Mapper:ATOW|;                        // DO NOT MODIFY
  36.  
  37.  
  38.     // Define your graphics
  39.  
  40. OpenResFile(HOME&"Resources");
  41.  
  42.     DefConst('kUSAGraphic, MakePixFamily(nil, nil, {rsrcSpec: "USA", bitDepth: 1}));                // MODIFY: Define each graphic from your Resources file    
  43.                                                                                                                                                                                     // bitDepth can be 1, 2, or 4, corresponding
  44.                                                                                                                                                                                     // to b&w, 4, and 16 shades of gray
  45.     DefConst('kMyGraphic, MakePixFamily(nil, nil, {rsrcSpec: "My Graphic", bitDepth: 4}));    // MODIFY: kMyGraphic is the name assigned to a PICT resource named
  46.                                                                     // "My Graphic" in the ResEdit file "Resources"
  47.     
  48. CloseResFile();
  49.  
  50.  
  51.     // Your Mapper Module
  52.  
  53. partdata :=    {    appSymbol: EnsureInternal(kAppSymbol),        // DO NOT MODIFY
  54.                 version: kVersionStr,                                                        // DO NOT MODIFY
  55.                 name: "My First Map",                                                        // MODIFY: The name of your Mapper Module
  56.                 
  57.                 maps:    {
  58.                                                                     // The main map is called "main". Each subsequent map can be called something
  59.                                                                     // else (i.e. "second", "another", etc.)
  60.                             
  61.                             main:        {    name: "USA",            // MODIFY: The name of this particular map
  62.                                             icon: kUSAGraphic,        // MODIFY: The graphic for this map (i.e.: kUSAGraphic)
  63.                                             buildings: nil,
  64.                                         },
  65.                             second:        {    name: "Second Map",        // MODIFY: The name of this particular map
  66.                                             icon: kMyGraphic,        // MODIFY: The graphic for this map (i.e. kMyGraphic)
  67.                                             buildings: nil,
  68.                                         },
  69.                             another:     {    name: "Another submap",    // MODIFY: The name of this particular map
  70.                                             icon: nil,                // No map will appear since the value for "icon" is "nil"
  71.                                             buildings: nil,
  72.                                         },
  73.                         },
  74.             };
  75.  
  76.  
  77.  
  78. /****************************************************************************************
  79.  ************************************* DO NOT MODIFY ************************************
  80.  ****************************************************************************************/
  81.  
  82. DefConst('kInstallFunc, func(partFrame) begin
  83.     local MapperMaps := GetGlobalVar(kMapperAppSymbol);
  84.     
  85.         // Load this map into the Mapper Maps Global Frame
  86.     
  87.     if not MapperMaps then
  88.         MapperMaps := DefGlobalVar(EnsureInternal(kMapperAppSymbol), EnsureInternal({}));
  89.     MapperMaps.(EnsureInternal(kAppSymbol)) := true;
  90.     
  91.         // Add this map 
  92.     
  93.     GetRoot().(EnsureInternal(kAppSymbol)) := partFrame.partData;
  94. end);
  95.  
  96. InstallScript := func(partFrame, removeFrame) begin
  97.     AddDeferredCall(kInstallFunc, [partFrame]);
  98. end;
  99.  
  100. RemoveScript := func(removeFrame)
  101. begin
  102.     local root := GetRoot();
  103.     local MapperMaps := GetGlobalVar(kMapperAppSymbol);
  104.     local Mapper := root.(kMapperAppSymbol);    
  105.     
  106.     RemoveSlot(root, kAppSymbol);
  107.     
  108.         // Remove this map from the Mapper Maps Global Frame
  109.     
  110.     if MapperMaps then
  111.         RemoveSlot(MapperMaps, kAppSymbol);
  112.     
  113.         // Update Mapper's display
  114.     
  115.     if Mapper and Visible(Mapper) then Mapper:BuildMaps();
  116. end;